﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EntityManage;

namespace ChatClient
{
    public partial class FormEditNickname : Form
    {
        public FormEditNickname()
        {
            InitializeComponent();
        }
        public FormEditNickname(int id)
        : this()
        {
            _id = id;
        }
        int _id;

        public string NickName
        {
            get { return txtNewName.Text; }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtNewName.Text == "")
            {
                return;
            }
            if (UserManager.EditNickName(_id, txtNewName.Text))
            {
                MessageBox.Show("修改成功");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }
    }
}
